import 'package:fish_redux/fish_redux.dart';

import 'action.dart';
import 'state.dart';

Reducer<UserTypeViewState> buildReducer() {
  return asReducer(
    <Object, Reducer<UserTypeViewState>>{
      UserTypeViewAction.action: _onAction,
      UserTypeViewAction.onTapIndex: _onTapIndex,
    },
  );
}

UserTypeViewState _onAction(UserTypeViewState state, Action action) {
  final UserTypeViewState newState = state.clone();
  return newState;
}

UserTypeViewState _onTapIndex(UserTypeViewState state, Action action) {
  final UserTypeViewState newState = state.clone()
    ..selectIndex = action.payload;
  return newState;
}
